import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PrinterInfoVO, PrinterInfoForm, PrinterInfoQuery } from '@/api/order/printerInfo/types';

/**
 * 查询打印机信息列表
 * @param query
 * @returns {*}
 */

export const listPrinterInfo = (query?: PrinterInfoQuery): AxiosPromise<PrinterInfoVO[]> => {
  return request({
    url: '/order/printerInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询打印机信息详细
 * @param id
 */
export const getPrinterInfo = (id: string | number): AxiosPromise<PrinterInfoVO> => {
  return request({
    url: '/order/printerInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增打印机信息
 * @param data
 */
export const addPrinterInfo = (data: PrinterInfoForm) => {
  return request({
    url: '/order/printerInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改打印机信息
 * @param data
 */
export const updatePrinterInfo = (data: PrinterInfoForm) => {
  return request({
    url: '/order/printerInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除打印机信息
 * @param id
 */
export const delPrinterInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/printerInfo/' + id,
    method: 'delete'
  });
};